<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>angularjs-双向绑定</title>
    <!--引入依赖-->
    <script src="js/angular.min.js"></script>
    <script>
        var module = angular.module("pingyougou",[]);
        module.controller("pingyougoucontroller",function ($scope) {
            $scope.add=function () {
                $scope.data= parseInt($scope.x) + parseInt($scope.y);
            }
            $scope.list=[1,2,3,4,5];
            $scope.obj=[
                {"name":"小红","age":23,"address":"南京"},
                {"name":"小黑","age":24,"address":"南通"},
                {"name":"小白","age":25,"address":"上海"}
            ]
        })
    </script>

</head>
<body>

<h3>
    <per>
        ng-model:表明在$scope中定义了一个变量username
        {{}}表明是去$scope中取数据或者直接输出常量
        控制层中有列表
    </per>
</h3>

<div ng-app="pingyougou" ng-controller="pingyougoucontroller">

    x:<input ng-model="x" /><br/>
    y:<input ng-model="y" /><br/>
    <button ng-click="add()">点击显示：</button>{{data}}
    <hr>
    <div ng-repeat="i in list">
        {{i}}
    </div>
    <hr>
    <!--从控制层中拿东西-->
    <div ng-repeat="i in obj">
        {{i.name}}-{{i.age}}-{{i.address}}
    </div>

</div>

</body>
</html>